package com.woniuxy.api;

import com.woniuxy.entity.Product;
import com.woniuxy.entity.ProductDTO;
import com.woniuxy.entity.utils.ResponseEntity;
import com.woniuxy.hystrix.FallbackFactoryCommand;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;


//@FeignClient("htj-product")
//@FeignClient(value = "htj-product",fallbackFactory = FallbackFactoryCommand.class)
@FeignClient(value = "htj-product")
@RequestMapping("/product")
public interface RemoteProductServe {

    @GetMapping("/{pid}")
    ResponseEntity findOneByPid(@PathVariable("pid") Integer pid);

    @PutMapping("/")
    ResponseEntity updateProduct(@RequestBody Product product);

    //    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice(@RequestParam("name") String name,@RequestParam("minPrice") double minPrice,
//                                               @RequestParam("maxPrice") double maxPrice);
//    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice1(@SpringQueryMap Map map);
    @GetMapping("/findCondition")
    public ResponseEntity findAllByNameOrPrice(@SpringQueryMap ProductDTO productDTO);

}
